<?php

function getPenalty($teamId, $round, $isArchive, $settings) {
	$sql = "SELECT * from teampenalty" . getTableExtension($isArchive) . " tp where teamId = $teamId and round = $round";
	$result = mysql_query($sql);
   	
   	$row = mysql_fetch_array($result);
   	$penalty = 0;
	
	if ($row != null) {
		if ($row["penaltyType"] == "FULL") {
			$penalty = -1 * $settings->fullLockoutPenalty;
		}
		else {
			$penalty = -1 * $settings->partialLockoutPenalty;
		}
	}
	
	
	return $penalty;
}

function insertBulkPenalty($teamIdList, $round, $penaltyType) {
	$sql = "INSERT INTO teampenalty (teamId, round, penaltyType) ";
	$sql .= "SELECT id, $round, '$penaltyType' from team where id in ($teamIdList);";
	echo $sql;
	mysql_query($sql);
}

?>
